﻿Imports DevExpress.XtraPrinting

Public Class frmReporteReversiones

    Private Sub frmReporteReversiones_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.dtpFechaInicio.EditValue = CDate("01/" & Date.Now.Month & "/" & Date.Now.Year)
        Me.dtpFechaFin.EditValue = Date.Now.Date.AddDays(1)
    End Sub

    Private Sub btnFiltrar_Click(sender As Object, e As EventArgs) Handles btnFiltrar.Click
        Me.Log_ReversionesTableAdapter.Fill(Me.MEGASTOREDataSet.log_Reversiones, Me.dtpFechaInicio.EditValue, Me.dtpFechaFin.EditValue)
    End Sub

    Private Sub btnExportarWord_Click(sender As Object, e As EventArgs) Handles btnExportarWord.Click
        If sfdWord.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim ps As New PrintingSystem()
            Dim link As New PrintableComponentLink(ps)
            link.Component = gcReversiones
            link.Landscape = False
            link.CreateDocument()
            link.PrintingSystemBase.ExportToRtf(sfdWord.FileName)
        End If
    End Sub

    Private Sub bnExportaXLS_Click(sender As Object, e As EventArgs) Handles bnExportaXLS.Click
        If sfdExcel.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim ps As New PrintingSystem()
            Dim link As New PrintableComponentLink(ps)
            link.Component = gcReversiones
            link.Landscape = False
            link.CreateDocument()
            link.PrintingSystemBase.ExportToXls(sfdExcel.FileName)
        End If
    End Sub

    Private Sub btnExportaPDF_Click(sender As Object, e As EventArgs) Handles btnExportaPDF.Click
        If sfdPDF.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            Dim ps As New PrintingSystem()
            Dim link As New PrintableComponentLink(ps)
            link.Component = gcReversiones
            link.Landscape = False
            link.CreateDocument()
            link.PrintingSystemBase.ExportToPdf(sfdPDF.FileName)
        End If
    End Sub
End Class